home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 2 / MacMania 2.toast / Demo's / Tools&Utilities / Programming / Curses / macurses.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-02  |  2.3 KB  |  84 lines  |  [TEXT/R*ch]

  1. /*    File macurses.h:
  2.  *        Special definitions/extensions for macintosh implementation of curses.
  3.  *        Of particular interest: If the macro MACCUR_REPLACE_STDIO is defined b4
  4.  *        this file is included, the standard IO calls printf, puts, putchar,
  5.  *        scanf, gets, and getchar are replaced by "maccur" versions that
  6.  *        read/write from the curses display.
  7.  *
  8.  *     Copyright (c) 1994
  9.  *    by Robert Zimmerman
  10.  *
  11.  *  This code may be included in any work, public or private, with the
  12.  *  exception of creating a commercial curses-compatible subroutine
  13.  *  library.  (In other words, use the code all you want, but please don't
  14.  *  rip off the author by reselling this code as your own).
  15.  *
  16.  */
  17.  
  18. #ifndef _MACURSES_H_LOADED
  19.  
  20. #define _MACURSES_H_LOADED
  21.  
  22. enum {                                        /* Possible actions on command-. */
  23.     MACCUR_EXIT_ON_BREAK,                    /* Exit immediately. */
  24.     MACCUR_SIGNAL_BREAK,                    /* Raise the SIGINT signal. */
  25.     MACCUR_IGNORE_BREAK                        /* Ignore it. */
  26. };
  27.  
  28. extern int _maccur_cols;                    /* Window will be initialized to this size. */
  29. extern int _maccur_lines;
  30. extern char *_maccur_font_name;                /* Font to use (C string). */
  31. extern int _maccur_font_size;                /* Size of font. */
  32. extern int _maccur_handle_break_option;        /* This determines what happens on CMD-. (see above). */
  33. extern int _maccur_about_res_id;            /* Resource id alert to display if About... is chosen from apple menu. */
  34. extern char *_maccur_pgm_name;                /* Program name for about and window title. */
  35. extern int _maccur_fg_sleep_ticks;            /* How much can WaitNextEvent sleep in foreground. */
  36. extern int _maccur_bg_sleep_ticks;            /* How much can WaitNextEvent sleep in background. */
  37. extern int _maccur_io_sleep_dvsr;            /* How many of the output calls (maccur_printf, etc) call maccur_cpu_share. */
  38.  
  39. #ifdef MACCUR_REPLACE_STDIO
  40.  
  41. #    define printf maccur_printf
  42. #    define puts maccur_puts
  43. #    undef putchar
  44. #    define putchar maccur_putchar
  45. #    define scanf maccur_scanf
  46. #    define gets maccur_gets
  47. #    undef getchar
  48. #    define getchar maccur_getchar
  49.  
  50. #endif /* MACCUR_REPLACE_STDIO */
  51.  
  52. void maccur_alert_msg(
  53. char *fmt,
  54. ...
  55. );
  56.  
  57. void maccur_cpu_share(void);
  58.  
  59. int maccur_printf(
  60. char *fmt,
  61. ...
  62. );
  63.  
  64. int maccur_puts(
  65. char *str
  66. );
  67.  
  68. int maccur_putchar(
  69. char c
  70. );
  71.  
  72. int maccur_scanf(
  73. char *fmt,
  74. ...
  75. );
  76.  
  77. char *maccur_gets(
  78. char *str
  79. );
  80.  
  81. int maccur_getchar(void);
  82.  
  83. #endif /* _MACURSES_H_LOADED */
  84.